package com.mohe.shanpao.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import tk.mybatis.mapper.common.Mapper;

/**
 * 公用服务实现类
 * @author caixiang
 * @since 2016年6月12日
 */
public class GenericServiceImpl<T> implements GenericService<T>
{
    
    @Autowired
    Mapper<T> mapper;
    
    @Override
    public T selectBean(T t)
    {
        return mapper.selectOne(t);
    }
    
    @Override
    public List<T> selectByExample(Object obj)
    {
        return mapper.selectByExample(obj);
    }
    
    @Override
    public List<T> selectAll()
    {
        return mapper.selectAll();
    }
    
    @Override
    public T selectByPrimaryKey(T record)
    {
        return mapper.selectByPrimaryKey(record);
    }
    
    @Override
    public int insert(T record)
    {
        return mapper.insert(record);
    }
    
    @Override
    public int insertSelective(T record)
    {
        return mapper.insertSelective(record);
    }
    
    @Override
    public int delete(T record)
    {
        return mapper.delete(record);
    }
    
    @Override
    public int deleteByPrimaryKey(Long id)
    {
        return mapper.deleteByPrimaryKey(id);
    }
    
    @Override
    public int updateByPrimaryKey(T record)
    {
        return mapper.updateByPrimaryKey(record);
    }
    
    @Override
    public int updateByPrimaryKeySelective(T record)
    {
        return mapper.updateByPrimaryKeySelective(record);
    }
    
    @Override
    public int selectCount(T t)
    {
        return mapper.selectCount(t);
    }
    
    @Override
    public int updateByExampleSelective(T t, Object example)
    {
        return mapper.updateByExampleSelective(t, example);
    }
}
